package com.atguigu.crowd.api;

import com.atguigu.crowd.util.ResultEntity;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.concurrent.TimeUnit;

/**
 * @author zzqstart
 * @Description
 * @date 2022-09-16 19:59
 */
@FeignClient("atguigu-crowd-redis")
public interface RedisRemoteService {
    @RequestMapping("/set/redis/key/value/remote")
    ResultEntity<String> setRedisKeyValueRemote(
            @RequestParam("key") String key,
            @RequestParam("value") String value
    );

    //    setRedisKeyValueRemoteWithTimeout
    @RequestMapping("set/redis/key/value/remote/with/timeout")
    ResultEntity<String> setRedisKeyValueRemoteWithTimeout(
            @RequestParam("key") String key,
            @RequestParam("value") String value,
            @RequestParam("time") long time,
            @RequestParam("timeUnit") TimeUnit timeUnit
    );

    //    getRedisStringValueByKeyRemote
    @RequestMapping("get/redis/string/value/by/key/remote")
    ResultEntity<String> getRedisStringValueByKeyRemote(
            @RequestParam("key")String key
    );

    //    removeRedisKeyRemote
    @RequestMapping("remove/redis/key/remote")
    ResultEntity<String> removeRedisKeyRemote(
            @RequestParam("key") String key
    );
}
